<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta charset="UTF-8">
    <!--<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>-->
    <meta name="viewport" content="width=640,user-scalable=no,target-densitydpi=320">
    <meta http-equiv="Content-Type" content="textml; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="author" content=""/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="MobileOptimized" content=""/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="format-detection" content="telephone=yes"/>
    <!-- no cache -->
    <meta http-equiv="cache-control" content="max-age=0">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT">
    <meta http-equiv="pragma" content="no-cache">
    <title>阳光乐选</title>
    <link rel="stylesheet" href="css_pk/layout_old.css">
    <!--<link rel="stylesheet" href="css_pk/swiper.min.css">-->
    <style>
        .hhhh{ position:fixed; top:-80px; left:5%; z-index:9999; width: 90%; padding: 15px 0px; background-color: #ddd; border: 1px solid #b10000; margin: auto; border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; -ms-border-radius: 8px; -o-border-radius: 8px; box-shadow: 0px 0px 2px #999999; -ms-box-shadow: 0px 0px 2px #999999; -webkit-box-shadow: 0px 0px 2px #999999; -moz-box-shadow: 0px 0px 2px #999999; -o-box-shadow: 0px 0px 2px #999999; margin-top: 20px; color: #000; font-size: 20px; font-weight: bold; text-align: center; border: 2px solid #fff; }
        input::-webkit-input-placeholder { /* WebKit browsers */
            color:    #b9a955;
        }
        input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
            color:    #b9a955;
        }
        input::-moz-placeholder { /* Mozilla Firefox 19+ */
            color:    #b9a955;
        }
        input:-ms-input-placeholder { /* Internet Explorer 10+ */
            color:    #b9a955;
        }
        .true_name{
            display: block;
            background: url("images/true_name.png") no-repeat;
            width:33px;
            height:34px;
            position: absolute;
            top: 14px;
            left: -45px;
        }
        .mobile{
            display: block;
            background: url("images/mobile.png") no-repeat;
            width:33px;
            height:34px;
            position: absolute;
            top: 14px;
            left: -45px;
        }
        .smscode{
            display: block;
            background: url("images/smscode.png") no-repeat;
            width:33px;
            height:34px;
            position: absolute;
            top: 14px;
            left: -45px;
        }
        .yanzheng{
            text-align: center;
            width:226px;
            height:47px;
            background: url("images/J_smscode.png") no-repeat;
            padding-top:10px;
            margin-top:5px;
        }
    </style>
</head>
<body>
<div class="swiper-container">
    <div class="swiper-wrapper">
        <div class="swiper-slide" style="background: rgba(0,0,0,0);">
            <a href="#">
                <img src="images/slide_img1.png" alt="">
            </a>
        </div>
    </div>


</div>
<div class="leadmu">
    <ul>
        <li>
            <a href="rule.html">
                <img src="images/rank1.png">
            </a>
        </li>
        <li>
            <a href="rank.html">
                <img src="images/rank.png">
            </a>
        </li>
        <li>
            <a href="index.html">
                <img src="images/rank2.png">
            </a>
        </li>
    </ul>
</div>
<div class="hhhh"></div>
<div class="submit_cover">
    <ul>

        <li>
            <div id="submit_bg">
                <ul>
                    <li>
                        <span class="true_name"></span>
                        <input type="text" placeholder="请输入姓名" id="true_name" name="mname" style="border: none;" maxlength="4"></li>
                    <li>
                        <span class="mobile" style="left: -40px;"></span>
                        <input type="tel" placeholder="请输入电话" id="mobile" name="tel" style="border: 5px solid rgba(0,0,0,0);margin-top: 0px;height: 62px;" maxlength="11"></li>
                    <li>
                        <div>
                            <span class="smscode" style="left: -40px;top: 20px;"></span>
                            <input type="tel" placeholder="请输入验证码" id="smscode" name="yzm" style="border: none;" maxlength="6"></div>
                        <div id="J_smscode" class="yanzheng" >获取验证码</div>
                    </li>
                    <li style="background-color:transparent">
                        <a id="J_regist"
                           style="height:47px;text-align: center;width:304px;border: none;display: block;color: #213663;
                            background: url(images/J_regist.png) 100% 100%;margin: 0 auto;">

                        </a>
                    </li>
                </ul>
            </div>
        </li>
    </ul>
</div>
<img src="images/foot.png" style="position:absolute;bottom:10px;left: 40%;">
</body>
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script>
    $(function(){
        var viewHeight = window.innerHeight;
        console.log($("body").css("height"));

        $("input").focus(function () {
            $("body").css("height", viewHeight);
            console.log($("body").css("height"));
        }).blur(function () {
            $("body").css("height", viewHeight);
        });

    })
</script>
<script>
    $(function () {


    var validCode=true;
    $("#msgs").click (function  () {
        var time=30;
        var code=$(this);
        if (validCode) {
            validCode=false;
            code.addClass("msgs1");
            var t=setInterval(function  () {
                time--;
                code.html(time+"秒");
                if (time==0) {
                    clearInterval(t);
                    code.html("重新获取");
                    validCode=true;
                    code.removeClass("msgs1");
                }
            },1000)
        }
    });

    $(".stxt").click(function (event) {
        event.stopPropagation();
    });
    $("#btn").click(function (event) {
        event.stopPropagation();
        $("#fanBox1").hide();
        $("#fanBox2").show();
    });
        var viewHeight = window.innerHeight;
    var viewHeight_submitCover = $("#submit_bg").height();
    var viewWidth_submitbg = $("#submit_bg").width();
    var J_smscode_height = $("#J_smscode").height();
    console.log(J_smscode_height);
    $("#J_smscode").css("line-height",J_smscode_height+"px");
    console.log(viewHeight);
    console.log(viewHeight_submitCover);
    console.log(viewWidth_submitbg);
    $("input").focus(function () {

        $("body").css("height", viewHeight);
        if(/Android [4-7]/.test(navigator.appVersion)) {

            $("#submit_bg").css({
                "height": viewHeight_submitCover,
                "position": "fixed",
                "left": "50%",
                "margin-left": -viewWidth_submitbg / 2
            });
            $("#close").css("margin-top","0");
        }

    }).blur(function () {

        $("body").css("height", viewHeight);
        if(/Android [4-7]/.test(navigator.appVersion)) {
            $("#submit_bg").css({
                "height": viewHeight_submitCover,
                "position": "",
                "margin": "0 auto"
            });
            $("#close").css("margin-top", "28.125%");
        }

    });
    var clicktxt6 = function () {
        $(".submit_cover").show();
    };
    $("#close").on("click",function(){
        console.log("click closeBtn");
        $(".submit_cover").css({'opacity':0,'z-index':0});
    });
    });
    $("#J_regist").click(function () {
        if(!$(this).hasClass("disable")){
            checkMobileForm(2, function(result){
                show_message("注册成功");
            });
        }
    });

    function show_message(msg){
        $('.hhhh').show();
        $('.hhhh').html(msg);
        $('.hhhh').animate({top:50},1000,function(){
            window.setTimeout(hide_message(),4000);
        });
    }

    function hide_message(){
        $('.hhhh').animate({top:-80},300);
        $('.hhhh').hide();
    }


    $("#J_smscode").click(function () {
//        $("#smscode").focus();
        if($(this).hasClass("disable")){
            show_message("验证码已发送，请稍后再试");
        }else{
            sendSmsCode($("#mobile").val());
        }
    });


    /**
     *	发送短信验证码
     */
    function sendSmsCode(phone){
        $('.hhhh').show();
        var regMobile=/^0?1(3|5|8|7)\d{9}$/;
        if(phone == ""){
            show_message("手机号不能为空");
        }else if(!regMobile.test(phone)){
            show_message("手机号格式错误");
        }else{
            //防止重发
            disableItem("J_smscode");

            $.post("{:U('scanPK2017/Settings/check_mobile')}", {mobile:phone}, function(result){
                var data = result.data;
                if(data.exist){
                    enableItem("J_smscode");
                    show_message("手机号已存在");
                }else{
                    //发送短信号码
                    $.post("{:U('scanPK2017/Settings/send_sms')}", {mobile:phone}, function(result){
                        var data = result.data;
                        if(data.status){ //发送成功
                            show_message("发送成功请查收");
                            disableItem("J_smscode");
                            var seed  = 60, timer = setInterval(function(){
                                seed --;
                                $("#J_smscode").html(seed + "秒");
                                if(seed<=0){
                                    enableItem("J_smscode");
                                    $("#J_smscode").html("重获验证码");
                                    clearInterval(timer);
                                }
                            }, 1000);
                        }else{
                            enableItem("J_smscode");
                            show_message("发送失败请重试");
                        }
                    }, 'json');
                }
            },'json');
        }
    }


    function disableItem(obj){
        $("#"+obj).prop("disabled", true).addClass("disable");
    }
    function enableItem(obj, html){
        $("#"+obj).prop("disabled", false).removeClass("disable");
    }

    function myrefresh(){
        location.reload();
    }

    function myrefresh2(){
        var my_url2 = "{:U('scanPK2017/Settings/show_qrcode')}";
        window.location.href = my_url2;
    }
</script>
</html>